<?php
	$MaBaiViet = $_GET['id'];
	$baiviet = new noidungtinbs();
	$baiviet->MaBaiViet = $MaBaiViet;
	$ds = $baiviet->GetAllList();
	$url_img = $ds[0]['HinhAnh'];
	if($url_img != "")
	{
		$delAnh = unlinkimg($url_img);
		
		$kq = $baiviet->Delete();
	
		if($kq && $delAnh)
			header("Location: baiviet");
		else
			ThongBaoLoi("Lỗi truy vấn!");
	}
	else
	{
	
		$kq = $baiviet->Delete();
		
		if($kq)
			header("Location: baiviet");
		else
			ThongBaoLoi("Lỗi truy vấn!");
	}
?>